package com.example.hms.controller;

import com.example.hms.service.DashboardService;
import com.example.hms.util.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * DashboardController类用于处理与仪表板相关的HTTP请求，
 * 提供房间数量、入住数量、收入等数据的查询接口。
 */
@RequestMapping("/dashboard")
@RestController
public class DashboardController {
    @Resource
    public DashboardService dashboardService;

    //  查询房间数量
    @RequestMapping(value = "/selectRoomNumber", method = RequestMethod.GET)
    public Result selectRoomNumber() {
        // 调用dashboardService的selectRoomNumber方法
        return dashboardService.selectRoomNumber();
    }

    //  查询入住数量
    @RequestMapping(value = "/selectLiveNumber", method = RequestMethod.GET)
    public Result selectLiveNumber() {
        // 调用dashboardService的selectLiveNumber方法
        return dashboardService.selectLiveNumber();
    }

    //  根据月份查询收入
    @RequestMapping(value = "/selectRevenue", method = RequestMethod.GET)
    public Result selectRevenue(String month) {
        // 调用dashboardService的selectRevenue方法，并传入month
        return dashboardService.selectRevenue(month);
    }

    //  根据月份查询收入详情
    @RequestMapping(value = "/selectRevenueByMonth", method = RequestMethod.GET)
    public Result selectRevenueByMonth(String month) {
        return dashboardService.selectRevenueByMonth(month);
    }


}
